Skip to content

[pull] master from tensorflow:master#1689

Merged
pull[bot] merged 6 commits into
GesuBackups:masterfrom
tensorflow:master
Apr 3, 2026
Merged

[pull] master from tensorflow:master#1689
pull[bot] merged 6 commits into
GesuBackups:masterfrom
tensorflow:master

Conversation

@pull

@pull pull Bot commented Apr 3, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

tensorflower-gardener and others added 6 commits April 2, 2026 18:54
PiperOrigin-RevId: 893813399
PiperOrigin-RevId: 893825872
Imported from GitHub PR openxla/xla#40329

Replaces the single integer-based `ExecutionStreamId` with a `std::variant<ComputationStreamId, CommunicationStreamId>` that encodes the stream kind in the type itself, eliminating the need for a separate `AsyncKind` enum and simplifying the execution stream assignment and thunk emission pipeline.

### Key changes

- **`execution_stream_id.h` (new)**: Introduces `ComputationStreamId` and `CommunicationStreamId` as strongly-typed int types, and `ExecutionStreamId` as a `std::variant` alias.

- **`async_thunk.h/cc`**: Replaces `AsyncKind` enum with `ExecutionStreamId` in constructor.

- **`execution_stream_assignment.h/cc`**: Simplified to only assign streams to scope-start operations (structured concurrency). Removed `AsyncExecutionStreamIds`, `GetSyncExecutionStreamId`, `GetAsyncExecutionStreamIds`. New API: `GetExecutionStreamId(instr)` returns `StatusOr<ExecutionStreamId>`. Renamed `kCollective` to `kCommunication` for consistency.

- **`thunk_emitter.cc`**: All `AsyncStartThunk` construction sites now obtain `ExecutionStreamId` from `ExecutionStreamAssignment::GetExecutionStreamId()` and pass it directly to the constructor. Removed all `set_execution_stream_id()` calls and `AsyncKind` references.

- **`gpu_executable.cc`**: Replaced `flat_hash_set<ExecutionStreamId>` stream scanning with `GetNumAdditionalComputeStreams()` that walks `AsyncStartThunk`s. Additional compute streams are now borrowed as a `std::vector<se::Stream*>` indexed by `ComputationStreamId`.

- **`thunk.h/cc`**: Removed `ExecutionStreamIdMap`, `kDefaultExecutionStreamId`, `execution_stream_id` from `ThunkInfo`, and `set_execution_stream_id` from `Thunk`.

### Motivation

The old design conflated stream identity with stream kind, requiring runtime checks and mutable state on thunks. The variant-based approach makes the distinction compile-time safe, removes mutable stream ID state from thunks, and aligns the execution stream assignment with structured concurrency (only scope-start operations need stream IDs).
Copybara import of the project:

--
ea6a0c02825441bbb8949f45f7bf64b913eb6746 by Eugene Zhulenev <ezhulenev@openxla.org>:

[xla:gpu] Cleanup execution stream id in GPU runtime

Merging this change closes #40329

PiperOrigin-RevId: 893865189
PiperOrigin-RevId: 893894990
PiperOrigin-RevId: 893900816
@pull pull Bot locked and limited conversation to collaborators Apr 3, 2026
@pull pull Bot added the ⤵️ pull label Apr 3, 2026
@pull pull Bot merged commit 2e98fee into GesuBackups:master Apr 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants